/**
 */
package usixmlcui.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

import usixmlcui.ConcreteGraphicalCompoundIU;
import usixmlcui.ConcreteGraphicalIU;
import usixmlcui.Tab;
import usixmlcui.Usixml_cuiPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Concrete Graphical Compound IU</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link usixmlcui.impl.ConcreteGraphicalCompoundIUImpl#getEReference0 <em>EReference0</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteGraphicalCompoundIUImpl#getEReference1 <em>EReference1</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteGraphicalCompoundIUImpl#getEReference2 <em>EReference2</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConcreteGraphicalCompoundIUImpl extends EObjectImpl implements ConcreteGraphicalCompoundIU {
	/**
	 * The cached value of the '{@link #getEReference0() <em>EReference0</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference0()
	 * @generated
	 * @ordered
	 */
	protected ConcreteGraphicalIU eReference0;

	/**
	 * The cached value of the '{@link #getEReference1() <em>EReference1</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference1()
	 * @generated
	 * @ordered
	 */
	protected ConcreteGraphicalIU eReference1;

	/**
	 * The cached value of the '{@link #getEReference2() <em>EReference2</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference2()
	 * @generated
	 * @ordered
	 */
	protected EList eReference2;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ConcreteGraphicalCompoundIUImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return Usixml_cuiPackage.Literals.CONCRETE_GRAPHICAL_COMPOUND_IU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalIU getEReference0() {
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetEReference0(ConcreteGraphicalIU newEReference0, NotificationChain msgs) {
		ConcreteGraphicalIU oldEReference0 = eReference0;
		eReference0 = newEReference0;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0, oldEReference0, newEReference0);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference0(ConcreteGraphicalIU newEReference0) {
		if (newEReference0 != eReference0) {
			NotificationChain msgs = null;
			if (eReference0 != null)
				msgs = ((InternalEObject)eReference0).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0, null, msgs);
			if (newEReference0 != null)
				msgs = ((InternalEObject)newEReference0).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0, null, msgs);
			msgs = basicSetEReference0(newEReference0, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0, newEReference0, newEReference0));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalIU getEReference1() {
		if (eReference1 != null && eReference1.eIsProxy()) {
			InternalEObject oldEReference1 = (InternalEObject)eReference1;
			eReference1 = (ConcreteGraphicalIU)eResolveProxy(oldEReference1);
			if (eReference1 != oldEReference1) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE1, oldEReference1, eReference1));
			}
		}
		return eReference1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalIU basicGetEReference1() {
		return eReference1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference1(ConcreteGraphicalIU newEReference1) {
		ConcreteGraphicalIU oldEReference1 = eReference1;
		eReference1 = newEReference1;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE1, oldEReference1, eReference1));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getEReference2() {
		if (eReference2 == null) {
			eReference2 = new EObjectWithInverseResolvingEList(Tab.class, this, Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE2, Usixml_cuiPackage.TAB__EREFERENCE3);
		}
		return eReference2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE2:
				return ((InternalEList)getEReference2()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0:
				return basicSetEReference0(null, msgs);
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE2:
				return ((InternalEList)getEReference2()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0:
				return getEReference0();
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE1:
				if (resolve) return getEReference1();
				return basicGetEReference1();
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE2:
				return getEReference2();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0:
				setEReference0((ConcreteGraphicalIU)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE1:
				setEReference1((ConcreteGraphicalIU)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE2:
				getEReference2().clear();
				getEReference2().addAll((Collection)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0:
				setEReference0((ConcreteGraphicalIU)null);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE1:
				setEReference1((ConcreteGraphicalIU)null);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE2:
				getEReference2().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE0:
				return eReference0 != null;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE1:
				return eReference1 != null;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_COMPOUND_IU__EREFERENCE2:
				return eReference2 != null && !eReference2.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ConcreteGraphicalCompoundIUImpl
